package com.softaria.windows.model;

import java.io.Serializable;

/**
 * POJO class which is used as address of perspective.
 * 
 * @author Roman M Kuzmin (roman@softaria.com)
 * 
 */
public class PerspectiveUrl implements Serializable {

  private static final long serialVersionUID = 1L;

  private String perspectiveId;

  public PerspectiveUrl(String perspectiveId2) {
    this.perspectiveId = perspectiveId2;
  }

  protected PerspectiveUrl() {

  }

  public String getPerspectiveId() {
    return perspectiveId;
  }

  public void setPerspectiveId(String perspectiveId) {
    this.perspectiveId = perspectiveId;
  }

  public boolean isView() {
    return false;
  }

  @Override
  public String toString() {

    return getPerspectiveId();
  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof PerspectiveUrl) {
      PerspectiveUrl otherPersp = (PerspectiveUrl) obj;

      if (otherPersp.isView())
        return false;

      return perspectiveId.equals(otherPersp.getPerspectiveId());
    } else {
      return false;
    }
  }

  @Override
  public int hashCode() {

    return getPerspectiveId().hashCode();
  }

}
